package ru.ng.sample.ui.test;

import org.apache.log4j.Logger;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * User: NGorosh
 * Date: 18.04.11
 * Time: 11:40
 */
public class MyInterceptor
    implements HandlerInterceptor
{
    private static final Logger log = Logger.getLogger( MyInterceptor.class );

    @Override
    public boolean preHandle( HttpServletRequest request, HttpServletResponse response, Object handler )
        throws Exception
    {
        log.debug( "Log 1" );
        return true;
    }

    @Override
    public void postHandle( HttpServletRequest request, HttpServletResponse response, Object handler,
                            ModelAndView modelAndView )
        throws Exception
    {
        log.debug( "Log 2" );
    }

    @Override
    public void afterCompletion( HttpServletRequest request, HttpServletResponse response, Object handler,
                                 Exception ex )
        throws Exception
    {
        log.debug( "Log 3" );
    }
}
